-
Notifications
You must be signed in to change notification settings - Fork 284
Quantifier instantiation via simplistic E-matching #8224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Quantifier instantiation via simplistic E-matching #8224
Conversation
|
Despite this being a "draft" PR I would like to ask for feedback on the following aspects:
|
e08d98e to
24806af
Compare
24806af to
69f8720
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8224 +/- ##
========================================
Coverage 80.00% 80.01%
========================================
Files 1700 1700
Lines 188257 188318 +61
Branches 73 73
========================================
+ Hits 150615 150679 +64
+ Misses 37642 37639 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
6e48e44 to
49b3909
Compare
7bb221f to
64252a0
Compare
d821caa to
090c84a
Compare
This is now done, comment explaining the (expected) verification failure is now included. |
090c84a to
72550cf
Compare
|
This needs serious consideration: failing quantifier instantiation is the leading source of proof brittleness, and we are opening the door to that here. |
|
I would much prefer a more deterministic, predictable and robust solution to this. |
|
Hard maybe? So, it would be good but there is going to be a limit on how much we can do like this. Unless we put a refinement loop around the solver and do something like MBQI. Getting that stable and reliable is tricky. Given the amount of work that has gone into E-matching in Z3 and Andy's decade+ of work on quantifiers in cvc5, I wonder whether it would be more efficient (in terms of dev-hours / things proved) to improve our SMT integration. To actually answer the question you asked, things that might help:
HTH |
72550cf to
5e379d6
Compare
5e379d6 to
e076dab
Compare
2a85427 to
9be48ee
Compare
conjunction(...) and disjunction(...) helper functions produce the appropriate result for empty operand sequences.
9be48ee to
9e896a5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements quantifier instantiation via E-matching for cases where eager (enumerative) instantiation cannot be applied. The implementation uses pattern matching on array index expressions to find suitable instantiation values from the solver's cache.
Key changes:
- Added E-matching based quantifier instantiation as a fallback when eager instantiation fails
- Removed the
lb > ubcheck in eager instantiation (correctly handles empty ranges with vacuous truth/false) - Updated test expectations to reflect that previously unsupported quantifier cases now work
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/solvers/flattening/boolbv_quantifier.cpp | Implements E-matching algorithm via instantiate_one_quantifier function and modifies finish_eager_conversion_quantifiers to apply it |
| regression/cbmc/Quantifiers-unbounded-array/test.desc | Test descriptor for new unbounded array quantifier test case |
| regression/cbmc/Quantifiers-unbounded-array/main.c | Test case demonstrating quantifier instantiation with unbounded arrays and loop invariants |
| regression/cbmc/Quantifiers-unbounded-array-overflow/test.desc | Test descriptor for overflow detection with quantifiers |
| regression/cbmc/Quantifiers-unbounded-array-overflow/main.c | Test case that validates overflow detection in loop invariants with quantifiers |
| regression/cbmc/Quantifiers-two-dimension-array/no-upper-bound.desc | Test descriptor for 2D array quantifier handling |
| regression/cbmc/Quantifiers-two-dimension-array/no-upper-bound.c | Test case for nested quantifiers over 2D arrays |
| regression/cbmc/Quantifiers-type/test.desc | Updated test expectations to reflect working quantifier support |
| regression/cbmc/Quantifiers-invalid-var-range/test.desc | Updated test expectations from KNOWNBUG to CORE status |
| doc/cprover-manual/cbmc-assertions.md | Updated documentation from "future releases will support" to "CPROVER supports" for quantifiers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| else | ||
| return conjunction(instantiations); |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing defensive check for quantifier type. Add an assertion or UNREACHABLE statement after the if-else chain to handle the case where q_expr.id() is neither ID_exists nor ID_forall, similar to the pattern used in eager_quantifier_instantiation at line 265.
| else | |
| return conjunction(instantiations); | |
| else if(q_expr.id() == ID_forall) | |
| return conjunction(instantiations); | |
| UNREACHABLE; | |
| return {}; |
| -- | ||
| Uses --no-standard-checks to contain verification time with MiniSat; with | ||
| CaDiCaL this completes in under 5 seconds either way. Takes an unknown amount of | ||
| time (has never been run to completition) when using Z3. |
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling error in comment: "completition" should be "completion".
| time (has never been run to completition) when using Z3. | |
| time (has never been run to completion) when using Z3. |
| #include "boolbv.h" | ||
|
|
Copilot
AI
Dec 19, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicate include directive detected. The header "boolbv.h" is included twice on consecutive lines. Remove one of these duplicate includes.
| #include "boolbv.h" |
Use E-matching on index expressions to instantiate quantifiers when eager instantiation (aka enumerative instantiation) cannot be applied.
9e896a5 to
d7eba68
Compare
Use E-matching on index expressions to instantiate quantifiers when eager instantiation (aka enumerative instantiation) cannot be applied.